package com.godme.loader;

public class CustomerClassLoader extends ClassLoader{

    private final BytesManager bytesManager;

    public CustomerClassLoader(BytesManager bytesManager){
        this.bytesManager = bytesManager;
    }

    @Override
    protected Class<?> findClass(String name) throws ClassNotFoundException {
        byte[] bytes = bytesManager.getBytes(name);
        return defineClass(null, bytes, 0, bytes.length);
    }
    interface BytesManager {
        byte[] getBytes(String name);
    }
}
